/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ultrasoft.farmasoft.domain;

import java.io.Serializable;
import java.util.Collection;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Administrador
 */
@Entity
@Table(name = "productattribute")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Productattribute.findAll", query = "SELECT p FROM Productattribute p"),
    @NamedQuery(name = "Productattribute.findByProductAttributeId", query = "SELECT p FROM Productattribute p WHERE p.productAttributeId = :productAttributeId"),
    @NamedQuery(name = "Productattribute.findByName", query = "SELECT p FROM Productattribute p WHERE p.name = :name"),
    @NamedQuery(name = "Productattribute.findByOrder", query = "SELECT p FROM Productattribute p WHERE p.order = :order"),
    @NamedQuery(name = "Productattribute.findByImage", query = "SELECT p FROM Productattribute p WHERE p.image = :image")})
public class Productattribute implements Serializable {
    private static final long serialVersionUID = 1L;
    /*
    @Id
    @Basic(optional = false)
    @Column(name = "productAttributeId")*/
    @Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer productAttributeId;
    @Basic(optional = false)
    @Column(name = "name")
    private String name;
    @Basic(optional = false)
    @Lob
    @Column(name = "detail")
    private String detail;
    @Basic(optional = false)
    @Column(name = "orderProductAttribute")
    private short order;
    @Column(name = "image")
    private String image;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "productattribute")
    private Collection<Productattributes> productattributesCollection;

    public Productattribute() {
    }

    public Productattribute(Integer productAttributeId) {
        this.productAttributeId = productAttributeId;
    }

    public Productattribute(Integer productAttributeId, String name, String detail, short order) {
        this.productAttributeId = productAttributeId;
        this.name = name;
        this.detail = detail;
        this.order = order;
    }

    public Integer getProductAttributeId() {
        return productAttributeId;
    }

    public void setProductAttributeId(Integer productAttributeId) {
        this.productAttributeId = productAttributeId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public short getOrder() {
        return order;
    }

    public void setOrder(short order) {
        this.order = order;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    @XmlTransient
    public Collection<Productattributes> getProductattributesCollection() {
        return productattributesCollection;
    }

    public void setProductattributesCollection(Collection<Productattributes> productattributesCollection) {
        this.productattributesCollection = productattributesCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (productAttributeId != null ? productAttributeId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Productattribute)) {
            return false;
        }
        Productattribute other = (Productattribute) object;
        if ((this.productAttributeId == null && other.productAttributeId != null) || (this.productAttributeId != null && !this.productAttributeId.equals(other.productAttributeId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ultrasoft.farmasoft.domain.Productattribute[ productAttributeId=" + productAttributeId + " ]";
    }
    
}
